# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=mutter
pkgver=42.2
pkgrel=1
pkgdesc="clutter-based window manager and compositor"
url="https://wiki.gnome.org/Projects/Mutter/"
arch="all !s390x !riscv64" # limited by gnome-settings-daemon -> rust
license="GPL-2.0-or-later"
depends="
	gnome-settings-daemon
	gsettings-desktop-schemas
	mutter-schemas
	xkeyboard-config
	xwayland
	zenity
	"
makedepends="
	at-spi2-core-dev
	cairo-dev
	dbus-dev
	elogind-dev
	eudev-dev
	fribidi-dev
	gdk-pixbuf-dev
	glib-dev
	gnome-desktop-dev
	gnome-settings-daemon-dev
	gobject-introspection-dev
	graphene-dev
	gtk+3.0-dev
	json-glib-dev
	libcanberra-dev
	libdrm-dev
	libgudev-dev
	libice-dev
	libinput-dev
	libsm-dev
	libwacom-dev
	libx11-dev
	libxau-dev
	libxcb-dev
	libxcomposite-dev
	libxcursor-dev
	libxdamage-dev
	libxext-dev
	libxfixes-dev
	libxi-dev
	libxinerama-dev
	libxkbcommon-dev
	libxkbfile-dev
	libxrandr-dev
	libxrender-dev
	libxtst-dev
	mesa-dev
	meson
	pango-dev
	pipewire-dev
	startup-notification-dev
	wayland-dev
	wayland-protocols
	xkeyboard-config-dev
	xorg-server
	xwayland-dev
	"
options="!check" # Can't be run with release builds
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-lang $pkgname-schemas::noarch"
source="https://download.gnome.org/sources/mutter/${pkgver%.*}/mutter-$pkgver.tar.xz
	fixudev-req.patch"

prepare() {
	default_prepare
	# disable test subdirs, causes looping on builders and we don't run
	# tests anyway
	sed -e '/subdir/d' -i cogl/tests/meson.build
}

build() {
	abuild-meson \
		-Degl_device=true \
		-Dudev=true \
		-Dnative_backend=true \
		-Dintrospection=true \
		-Dremote_desktop=true \
		-Dprofiler=false \
		-Dtests=false \
		. output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

schemas() {
	pkgdesc="Mutter schemas related files"
	depends=""

	amove usr/share/glib-2.0/schemas
	amove usr/share/GConf/gsettings
	amove usr/share/gnome-control-center/keybindings
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
e43bdc7c9183b2578ae1f777fdf84bfde550a26bfc28fd4a1a183c7f310d852110f3dcabd50a2fabdafba4cfb8aa6577aec4c65775075f0afff7bd1bb4dde957  mutter-42.2.tar.xz
6f21171bbd0ad0fc67cbaf5fb1478b22b482a9ae33b9328cc51a5dd31bcf7d95cd41e6cbbac21d3d8801cc064a62a64ae38ed7d0501ab605b861058c32f3bc30  fixudev-req.patch
"
